﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XPathAutoSuggest {
    /// <summary>
    /// Specifies the members that should be possessed by a helper class that can handle typical File IO
    /// </summary>
    /// <remarks>
    /// Using an interface meets a couple of design goals, including SOLID design prinicple "Interface Segregation".
    /// Makes some testing possible via mocks.
    /// </remarks>
    public interface IFileIoHelper {
        /// <summary>
        /// Writes the XML to the file
        /// </summary>
        /// <param name="formattedXml">The XML to save</param>
        /// <param name="fileName">The file</param>
        /// <param name="isDirty">Flag to update</param>
        /// <param name="statusInfo">Message on success</param>
        void SaveToFile(string formattedXml, string fileName, ref bool isDirty, ref string statusInfo);

        /// <summary>
        /// Prompts user for a file name for saving
        /// </summary>
        /// <returns>The file name</returns>
        string GetSaveFileName();

        /// <summary>
        /// Gets a file name fo ropening
        /// </summary>
        /// <returns>The file name</returns>
        string GetOpenFileName();

        /// <summary>
        /// Reads file, returns contents
        /// </summary>
        /// <param name="inFileName">File to open</param>
        /// <returns>File contents if the file exists</returns>
        string ReadFile(string inFileName);
    }
}
